

from rest_framework.routers import SimpleRouter
from BookTest.views import *
from django.contrib import admin
from django.urls import path
from rest_framework.documentation import include_docs_urls

urlpatterns = [
    # django自带的管理后端站点
    path('admin/', admin.site.urls),

    # drf接口文档中心
    path('docs/', include_docs_urls(title="图书英雄接口管理中心"))
]

# 1、实例化router对象
router = SimpleRouter()
# 2、注册视图集
router.register(prefix='books', viewset=BooksView, base_name='books')
router.register(prefix='heros', viewset=HerosView, base_name='heros')
# 3、添加路由表
urlpatterns += router.urls